package com.ruoyi.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.domain.HhSize;
import com.ruoyi.mapper.HhSizeMapper;
import com.ruoyi.service.IHhSizeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品规格Service业务层处理
 * @author chongjin
 * @date 2020-12-17
 */
@Service
public class HhSizeServiceImpl implements IHhSizeService {
    @Autowired
    private HhSizeMapper hhSizeMapper;

    /**
     * 查询商品规格
     * @param sizeId 商品规格ID
     * @return 商品规格
     */
    @Override
    public HhSize selectHhSizeById(Long sizeId) {
        return hhSizeMapper.selectHhSizeById(sizeId);
    }

    /**
     * 查询商品规格列表
     * @param hhSize 商品规格
     * @return 商品规格
     */
    @Override
    public List<HhSize> selectHhSizeList(HhSize hhSize) {
        return hhSizeMapper.selectHhSizeList(hhSize);
    }

    /**
     * 新增商品规格
     * @param hhSize 商品规格
     * @return 结果
     */
    @Override
    public int insertHhSize(HhSize hhSize) {
        return hhSizeMapper.selectHhSize(hhSize) > 0 ? 0 : hhSizeMapper.insertHhSize(hhSize);
    }

    /**
     * 修改商品规格
     * @param hhSize 商品规格
     * @return 结果
     */
    @Override
    public int updateHhSize(HhSize hhSize) {
        return hhSizeMapper.updateHhSize(hhSize);
    }

    /**
     * 删除商品规格对象
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteHhSizeByIds(String ids) {
        return hhSizeMapper.deleteHhSizeByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除商品规格信息
     * @param sizeId 商品规格ID
     * @return 结果
     */
    @Override
    public int deleteHhSizeById(Long sizeId) {
        return hhSizeMapper.deleteHhSizeById(sizeId);
    }
}
